import java.util.Random;//导入的用于生成随机值的包
import java.util.Scanner;

public class guess {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner sc = new Scanner(System.in);
        int toGuess = random.nextInt(100);//将在1~100之间随意生成随机值
        while(true){
            System.out.println("请在1~100之间猜一个数字：");
            int num = sc.nextInt();
            if(num < toGuess){
                System.out.println("猜低了");
            }else if(num > toGuess){
                System.out.println("猜高了");
            }else{
                System.out.println("猜对了");
                break;
            }
        }
        sc.close();
    }
}

class age{
    public static void main(String[] args) {
        System.out.println("请输入年龄：");
        Scanner sc = new Scanner(System.in);
        int age = sc.nextInt();
        if(age > 0 && age <=18){
            System.out.println("少年");
        }else if(age > 18 && age <=28){
            System.out.println("青年");
        }else if(age > 28 && age <=55){
            System.out.println("中年");
        }else{
            System.out.println("老年");
        }

    }
}

class num{
    public static void main(String[] args) {
        System.out.println("请输入数字：");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int i = 2;
        for(;i < Math.sqrt(num);i++){
            if(num % i == 0) {
                System.out.println(num + "不是素数");
                break;
            }
        }
        if(i > Math.sqrt(num)){
            System.out.println(num + "是素数");
        }
    }
}

class leapYear{
    public static void main(String[] args) {
        int year = 1000;
        for (; year < 2000; year++) {
            int flg = isLeapYear(year);
        }
    }
    public static int isLeapYear(int year){
        if((0 == year % 4 && 0 != year % 100) || 0 == year % 400){
            System.out.println(year);
        }
        return 0;
    }
}

class chengFa{
    public static void main1(String[] args) {
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
        int i = 0;
        int j = 0;
        int cheng = 0;
        for(i = 1; i < 10; i++){
            for(j = 1; j <=i; j++){
                cheng = i * j;
                System.out.print(i +"*"+ j +"="+ cheng +" " );
            }
            System.out.println("\n");
        }
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { //可以使编程运行完不结束，使得可以多次输入输出，输入三个z回车退出程序
            int n = in.nextInt(); //n:行数
            for(int i = 0;i < n;i++) {
                for(int j = 0;j < n;j++) {
                    if(i == j || (i+j) == n-1) {
                        System.out.print("*");
                    }else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
}
